﻿from abc import ABC

from osc02.domain.activities.Activity import Activity


class OnsiteActivity(Activity, ABC):
    def __init__(self, name, duration=None, lag=0,
                 duration_likely=20,
                 duration_low=10, duration_high=45,
                 completion_event=None,
                 worker_skill=0, worker_num=0
                 ):
        super().__init__(name, duration, lag, duration_likely, duration_low, duration_high, completion_event)
        # add the vol to deactivate exception from MonitoredZFilterStore in which vol is accessed
        self.vol = 0
        self.construction_site = None
        self.worker_skill = worker_skill
        self.worker_num = worker_num

    def __repr__(self):
        to_nodes_names = []
        for to_node_name in self.to_nodes:
            to_nodes_names.append(to_node_name.name + ",")

        incoming_nodes_names = []
        for incoming_node_name in self.incoming_nodes:
            incoming_nodes_names.append(incoming_node_name.name)

        return super().__repr__() \
               + 'incoming_nodes=' + str(incoming_nodes_names) + ', ' \
               + 'to_nodes=' + str(to_nodes_names) + ', ' \
               + 'es=' + str(self.es) + ', ' \
               + 'ls=' + str(self.ls) + ', ' \
               + 'worker_type=' + str(self.worker_skill) + ', ' \
               + 'worker_num=' + str(self.worker_num) + ', '
